﻿define('jquery', function () { return window.jQuery; });
define('ko', function () { return window.ko; });

require(['router', 'viewManager', 'data', 'system'], function (router, viewManager, data, system) {

    system.debug(true);

    window.onerror = function(e) {
        alert(e);
    };

    function hideSplash() {
        $('.splash').hide();
    }

    data.initialize().then(function () {

        router.registerRoute({
            action: viewManager.showView,
            name: 'index',
            isDefault: true
        });
        router.registerRoute({
            action: viewManager.showView,
            name: 'userlist'
        });
        router.registerRoute({
            action: viewManager.showView,
            name: 'edituser'
        });
        router.registerRoute({
            action: viewManager.showView,
            name: 'customerlist'
        });
        router.registerRoute({
            action: viewManager.showView,
            name: 'editcustomer'
        });
        router.registerRoute({
            action: viewManager.showView,
            name: 'projectlist'
        });
        router.registerRoute({
            action: viewManager.showView,
            name: 'editproject'
        });
        router.registerRoute({
            action: viewManager.showView,
            name: 'createtask'
        });
        router.registerRoute({
            action: viewManager.showView,
            name: 'tasklist'
        });
        router.registerRoute({
            action: viewManager.showView,
            name: 'admin'
        }); 
        router.registerRoute({
            action: viewManager.showView,
            name: 'adminCustomer'
        });
        router.run();
        hideSplash();
        
    });
});